<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head>
	<link th:href="@{/project/css/ry-ui.css}" rel="stylesheet"/>
	<link th:href="@{/project/css/public.css}" rel="stylesheet"/>
	<link th:href="@{/project/css/proList.css}" rel="stylesheet"/>
	<link th:href="@{/project/css/mygxin.css}" rel="stylesheet"/>
</head>
<body style="overflow: hidden;">
	<div class="adddz">
		<form id="user-addr-form" th:object="${userAddress}">
			<input type="hidden" name="id" th:value="*{id}">
			<div class="form_group city" data-toggle="distpicker" data-autoselect="3">
				<select class="form-control" name="province" th:attr="data-province=*{province}"></select><br>
				<select class="form-control" name="city" th:attr="data-city=*{city}"></select><br>
				<select class="form-control" name="district" id="plugdistrict" th:attr="data-district=*{district}"></select>
			</div>
			<div class="form_group">
				<input type="text" placeholder="姓名" class="on"  name="receiveUser" th:value="*{receiveUser}" />
			</div>
			<div class="form_group">
				<input type="text" placeholder="手机号" maxlength="11" name="receiveTel" th:value="*{receiveTel}" />
			</div>
			<div class="form_group">
				<textarea name="receiveAddr" th:text="*{receiveAddr}" placeholder="详细地址"></textarea>
			</div>
			<div class="bc">
				<input type="submit" value="保存" />
				<input type="button" onclick="$.modal.close()" value="关闭">
			</div>
		</form>
	</div>
<div th:include="include::footer_normal"></div>
<script th:src="@{/ajax/libs/distpicker/distpicker.js}"></script>
<script th:inline="javascript">
	var formId = "user-addr-form";
    $("#"+formId).validate({
        rules:{
            province:{
                required:true,
            },
            city:{
                required:true,
            },
            district:{
                required:true,
            },
            receiveUser:{
                required:true,
            },
            receiveAddr:{
                required:true,
            },
            receiveTel:{
                required:true,
                isPhone:true
            }
        }
    });

    $.form.init({
        formId:formId,
        url:ctx + "user/userAddress/add",
        beforeSubmit:function () {
            return $.validate.form(formId);
        },
        success:function (result) {
            if(result.code ==  web_status.SUCCESS){
                parent.location.reload();
			}
        }
    });
</script>
</body>
</html>